/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.prepay.entity;

import javax.validation.constraints.NotBlank;

import com.jeesite.modules.base.entity.supplier.Supplier;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.jeesite.common.collect.ListUtils;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 预付款Entity
 * @author wsm
 * @version 2021-03-18
 */
@Table(name="t_prepayment", alias="a", columns={
		@Column(name="prepayment_id", attrName="prepaymentId", label="预付款ID", isPK=true),
		@Column(name="prepayment_code", attrName="prepaymentCode", label="编号", queryType=QueryType.LIKE),
		@Column(name="supplier_id", attrName="supplierId", label="供应商"),
		@Column(name="date", attrName="date", label="日期"),
		@Column(name="status1", attrName="status1", label="状态"),
		@Column(name="bill_status", attrName="billStatus", label="审批状态"),
		@Column(name="service_order_id", attrName="serviceOrderId", label="服务订单"),
		@Column(name="payment_account", attrName="paymentAccount", label="付款账号"),
		@Column(name="estimated_payment_amount", attrName="estimatedPaymentAmount", label="预计付款合计", isQuery=false),
		@Column(name="currency", attrName="currency", label="币种"),
		@Column(name="prepayment_balance", attrName="prepaymentBalance", label="预付款余额", isQuery=false),
		@Column(name="prepayment_type", attrName="prepaymentType", label="预付款类型", isQuery=false),
		@Column(name="actual_payment_amount", attrName="actualPaymentAmount", label="实际付款合计", isQuery=false),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false, isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者"),
		@Column(name="update_date", attrName="updateDate", label="更新时间"),
		@Column(name="remarks", attrName="remarks", label="备注信息", isQuery=false),
		@Column(name="parent_bill_type", attrName="parentBillType", label="前置单据类型"),
		@Column(name="parent_bill_code", attrName="parentBillCode", label="前置单据编号"),
		@Column(name="row_number", attrName="rowNumber", label="融资服务订单用的行号"),
	},joinTable= {
		@JoinTable(type=Type.LEFT_JOIN, entity= Supplier.class, attrName="supplier", alias="b",
				on="b.supplier_id = a.supplier_id", columns={
				@Column(name="supplier_id", label="供货外商编码", isPK=true),
				@Column(name="supplier_name", label="供货外商名称", isQuery=false),
		}),
		@JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = ServiceOrder.class, attrName = "serviceOrder", alias = "c",
				on = "c.service_order_id = a.service_order_id", columns = {
				@Column(name = "service_order_id", label = "服务订单id", isPK = true),
				@Column(name = "service_order_code", label = "服务订单编号"),
		})
},orderBy="a.update_date DESC"
)
public class Tprepayment extends DataEntity<Tprepayment> {
	
	private static final long serialVersionUID = 1L;
	private String prepaymentId;		// 预付款ID
	private String prepaymentCode;		// 编号
	private String supplierId;		// 供应商
	private Date date;		// 日期
	private String status1;		// 状态
	private String serviceOrderId;		// 服务订单
	private String paymentAccount;		// 付款账号
	private Double estimatedPaymentAmount;		// 预计付款合计
	private String currency;		// 币种
	private Double prepaymentBalance;		// 预付款余额
	private String prepaymentType;		// 预付款类型
	private Double actualPaymentAmount;		// 实际付款合计
	private String parentBillType;//前置单据类型
	private String parentBillCode;//前置单据编号
	private String parentBillCode1;//前置单据编号
	private Supplier supplier;
	private String billStatus;//审批状态
	private ServiceOrder serviceOrder;

	private List<TprepaymentEstimated> tprepaymentEstimatedList = ListUtils.newArrayList();		// 子表列表
	private List<TprepaymentActual> tprepaymentActualList = ListUtils.newArrayList();		// 子表列表
	private Integer rowNumber;//融资服务订单生成该订单时用的，不用不要管。

	public Integer getRowNumber() {
		return rowNumber;
	}

	public void setRowNumber(Integer rowNumber) {
		this.rowNumber = rowNumber;
	}

	public ServiceOrder getServiceOrder() {
		return serviceOrder;
	}

	public void setServiceOrder(ServiceOrder serviceOrder) {
		this.serviceOrder = serviceOrder;
	}

	public String getParentBillCode1() {
		return parentBillCode1;
	}

	public void setParentBillCode1(String parentBillCode1) {
		this.parentBillCode1 = parentBillCode1;
	}

	public String getParentBillType() {
		return parentBillType;
	}

	public void setParentBillType(String parentBillType) {
		this.parentBillType = parentBillType;
	}

	public String getParentBillCode() {
		return parentBillCode;
	}

	public void setParentBillCode(String parentBillCode) {
		this.parentBillCode = parentBillCode;
	}

	public String getPrepaymentType() {
		return prepaymentType;
	}

	public void setPrepaymentType(String prepaymentType) {
		this.prepaymentType = prepaymentType;
	}

	public String getBillStatus() {
		return billStatus;
	}

	public void setBillStatus(String billStatus) {
		this.billStatus = billStatus;
	}

	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	public Tprepayment() {
		this(null);
	}

	public Tprepayment(String id){
		super(id);
	}
	
	public String getPrepaymentId() {
		return prepaymentId;
	}

	public void setPrepaymentId(String prepaymentId) {
		this.prepaymentId = prepaymentId;
	}
	

	@Length(min=0, max=100, message="编号长度不能超过 100 个字符")
	public String getPrepaymentCode() {
		return prepaymentCode;
	}

	public void setPrepaymentCode(String prepaymentCode) {
		this.prepaymentCode = prepaymentCode;
	}
	
	@NotBlank(message="供应商不能为空")
	@Length(min=0, max=64, message="供应商长度不能超过 64 个字符")
	public String getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(String supplierId) {
		this.supplierId = supplierId;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	@Length(min=0, max=1, message="状态长度不能超过 1 个字符")
	public String getStatus1() {
		return status1;
	}

	public void setStatus1(String status1) {
		this.status1 = status1;
	}
	
	@NotBlank(message="服务订单不能为空")
	@Length(min=0, max=64, message="服务订单长度不能超过 64 个字符")
	public String getServiceOrderId() {
		return serviceOrderId;
	}

	public void setServiceOrderId(String serviceOrderId) {
		this.serviceOrderId = serviceOrderId;
	}
	
	@Length(min=0, max=100, message="付款账号长度不能超过 100 个字符")
	public String getPaymentAccount() {
		return paymentAccount;
	}

	public void setPaymentAccount(String paymentAccount) {
		this.paymentAccount = paymentAccount;
	}
	
	public Double getEstimatedPaymentAmount() {
		return estimatedPaymentAmount;
	}

	public void setEstimatedPaymentAmount(Double estimatedPaymentAmount) {
		this.estimatedPaymentAmount = estimatedPaymentAmount;
	}
	
	@NotBlank(message="币种不能为空")
	@Length(min=0, max=2, message="币种长度不能超过 2 个字符")
	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}
	
	public Double getPrepaymentBalance() {
		return prepaymentBalance;
	}

	public void setPrepaymentBalance(Double prepaymentBalance) {
		this.prepaymentBalance = prepaymentBalance;
	}

	
	public Double getActualPaymentAmount() {
		return actualPaymentAmount;
	}

	public void setActualPaymentAmount(Double actualPaymentAmount) {
		this.actualPaymentAmount = actualPaymentAmount;
	}
	
	public Date getDate_gte() {
		return sqlMap.getWhere().getValue("date", QueryType.GTE);
	}

	public void setDate_gte(Date date) {
		sqlMap.getWhere().and("date", QueryType.GTE, date);
	}
	
	public Date getDate_lte() {
		return sqlMap.getWhere().getValue("date", QueryType.LTE);
	}

	public void setDate_lte(Date date) {
		sqlMap.getWhere().and("date", QueryType.LTE, date);
	}
	
	public Date getUpdateDate_gte() {
		return sqlMap.getWhere().getValue("update_date", QueryType.GTE);
	}

	public void setUpdateDate_gte(Date updateDate) {
		sqlMap.getWhere().and("update_date", QueryType.GTE, updateDate);
	}
	
	public Date getUpdateDate_lte() {
		return sqlMap.getWhere().getValue("update_date", QueryType.LTE);
	}

	public void setUpdateDate_lte(Date updateDate) {
		sqlMap.getWhere().and("update_date", QueryType.LTE, updateDate);
	}
	
	public List<TprepaymentEstimated> getTprepaymentEstimatedList() {
		return tprepaymentEstimatedList;
	}

	public void setTprepaymentEstimatedList(List<TprepaymentEstimated> tprepaymentEstimatedList) {
		this.tprepaymentEstimatedList = tprepaymentEstimatedList;
	}
	
	public List<TprepaymentActual> getTprepaymentActualList() {
		return tprepaymentActualList;
	}

	public void setTprepaymentActualList(List<TprepaymentActual> tprepaymentActualList) {
		this.tprepaymentActualList = tprepaymentActualList;
	}
	
}